package com.hailin.pigribbon.controller;

import com.hailin.pigapi.common.Result;
import com.hailin.pigapi.model.auth.UserInfoDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
@RequestMapping(value = "/ribbon")
public class RibbonController {

    @Autowired
    private RestTemplate restTemplate;

    @GetMapping("/getUserById")
    public Result<UserInfoDto> getUserById(String userId){
        Result<UserInfoDto> userInfoDto = restTemplate.getForObject("http://pig-auth/pigAuth/getUserById?userId="+userId,Result.class,userId);
        return userInfoDto;
    }
}
